package com.keur.money.utils.helper

import android.Manifest
import com.keur.money.R
import com.keur.money.app.MyApp
import org.json.JSONArray
import org.json.JSONObject

/**
 * 权限帮助类
 */
object KeurPermissionHelper {

    /**
     * sms
     */
    fun takeKeurPerMSAGItem(): JSONObject{
        val item = JSONObject()
        item.put("isSystem",true)
        item.put("icon", R.mipmap.mulla_permission_item_sms_icon)
        item.put("permission", Manifest.permission.READ_SMS)
        item.put("title", MyApp.context.getString(R.string.permission_msg_title))
        val msgArray = JSONArray()
        val obj1 = JSONObject()
        obj1.put("title", MyApp.context.getString(R.string.permission_msg_why))
        obj1.put("des", MyApp.context.getString(R.string.permission_msg_why_desc))
        msgArray.put(obj1)

        val obj2 = JSONObject()
        obj2.put("title", MyApp.context.getString(R.string.permission_msg_do))
        obj2.put("des", MyApp.context.getString(R.string.permission_msg_do_desc))
        msgArray.put(obj2)

        val obj3 = JSONObject()
        obj3.put("title", MyApp.context.getString(R.string.permission_msg_data_safety))
        obj3.put("des", MyApp.context.getString(R.string.permission_msg_data_safety_desc))
        msgArray.put(obj3)
        item.put("msgList",msgArray)
        return item
    }

    /**
     * device
     */
    fun takeKeurPerDeviceItem(): JSONObject{
        val item = JSONObject()
        item.put("isSystem",false)
        item.put("icon", R.mipmap.mulla_permission_item_device_icon)
        item.put("permission", MyApp.context.getString(R.string.permission_device_title))
        item.put("title", MyApp.context.getString(R.string.permission_device_title))
        val msgArray = JSONArray()
        val obj1 = JSONObject()
        obj1.put("title", "")
        obj1.put("des", MyApp.context.getString(R.string.permission_device_desc))
        msgArray.put(obj1)

        item.put("msgList",msgArray)
        return item
    }

    /**
     * app list
     */
    fun takeKeurPerAplItem(): JSONObject{
        val item = JSONObject()
        item.put("isSystem",false)
        item.put("icon", R.mipmap.mulla_permission_item_apl_icon)
        item.put("permission", MyApp.context.getString(R.string.permission_apl_title))
        item.put("title", MyApp.context.getString(R.string.permission_apl_title))
        val msgArray = JSONArray()
        val obj1 = JSONObject()
        obj1.put("title", "")
        obj1.put("des", MyApp.context.getString(R.string.permission_apl_desc1))
        msgArray.put(obj1)

        val obj2 = JSONObject()
        obj2.put("title", "")
        obj2.put("des", MyApp.context.getString(R.string.permission_apl_desc2))
        msgArray.put(obj2)

        val obj3 = JSONObject()
        obj3.put("title", "")
        obj3.put("des", MyApp.context.getString(R.string.permission_apl_desc3))
        msgArray.put(obj3)
        item.put("msgList",msgArray)
        return item
    }

    /**
     * camera
     */
    fun takeKeurPerCameraItem(): JSONObject{
        val item = JSONObject()
        item.put("isSystem",true)
        item.put("icon", R.mipmap.mulla_permission_item_camera_icon)
        item.put("permission",  Manifest.permission.CAMERA)
        item.put("title", MyApp.context.getString(R.string.permission_camera_title))
        val msgArray = JSONArray()
        val obj1 = JSONObject()
        obj1.put("title", "")
        obj1.put("des", MyApp.context.getString(R.string.permission_camera_desc1))
        msgArray.put(obj1)

        val obj2 = JSONObject()
        obj2.put("title", "")
        obj2.put("des", MyApp.context.getString(R.string.permission_camera_desc2))
        msgArray.put(obj2)

        val obj3 = JSONObject()
        obj3.put("title", "")
        obj3.put("des", MyApp.context.getString(R.string.permission_camera_desc3))
        msgArray.put(obj3)

        item.put("msgList",msgArray)
        return item
    }

    /**
     * storage
     */
    fun takeKeurPerStorageItem(): JSONObject{
        val item = JSONObject()
        item.put("isSystem",false)
        item.put("icon", R.mipmap.mulla_permission_item_storage_icon)
        item.put("permission", MyApp.context.getString(R.string.permission_storage_title))
        item.put("title", MyApp.context.getString(R.string.permission_storage_title))
        val msgArray = JSONArray()
        val obj1 = JSONObject()
        obj1.put("title", "")
        obj1.put("des", MyApp.context.getString(R.string.permission_storage_desc))
        msgArray.put(obj1)

        item.put("msgList",msgArray)
        return item
    }

    /**
     * contact
     */
    fun takeKeurPerPhoneBookItem(): JSONObject{
        val item = JSONObject()
        item.put("isSystem",false)
        item.put("icon", R.mipmap.mulla_permission_item_contact_icon)
        item.put("permission", MyApp.context.getString(R.string.permission_contact_title))
        item.put("title", MyApp.context.getString(R.string.permission_contact_title))
        val msgArray = JSONArray()
        val obj1 = JSONObject()
        obj1.put("title", "")
        obj1.put("des", MyApp.context.getString(R.string.permission_contact_desc))
        msgArray.put(obj1)

        item.put("msgList",msgArray)
        return item
    }


    /**
     * album
     */
    fun takeKeurPerAlbumItem(): JSONObject{
        val item = JSONObject()
        item.put("isSystem",false)
        item.put("icon", R.mipmap.mulla_permission_item_album_icon)
        item.put("permission", MyApp.context.getString(R.string.permission_album_title))
        item.put("title", MyApp.context.getString(R.string.permission_album_title))
        val msgArray = JSONArray()
        val obj1 = JSONObject()
        obj1.put("title", "")
        obj1.put("des", MyApp.context.getString(R.string.permission_album_desc))
        msgArray.put(obj1)

        item.put("msgList",msgArray)
        return item
    }

}